/*============================================================================*/
/*                        Tortoise Team                                       */
/*============================================================================*/
/*                        OBJECT SPECIFICATION                                */
/*============================================================================*
* C Include:        %HAL_DcMotor.h%
* Instance:         RPL_1
* %version:         1 %
* %created_by:      Jose Antonio Leon Jazo %
* %date_created:    Wensday October 3 7:11:01 2012 %
*=============================================================================*/
/* DESCRIPTION : Header file for the hardware abstraction layer for the dc 	  */
/*      motor                                                                 */
/*============================================================================*/
/* FUNCTION COMMENT : contains the prototypes of the functions used to control*/
/*      the dc motor                                                       */
/*                                                                            */
/*============================================================================*/
/*                               OBJECT HISTORY                               */
/*============================================================================*/
/*  REVISION |   DATE      |                               |      AUTHOR      */
/*----------------------------------------------------------------------------*/
/*  1.0      | 26/05/2012  | 				               | Antonio Leon     */
/* Integration under Continuus CM                                             */
/*============================================================================*/

#ifndef HAL_DCMOTOR_H                               /* To avoid double inclusion */
#define HAL_DCMOTOR_H

/* Includes */
/* -------- */
#include "stdtypedef.h"
#include "MAL_EMIOS.h"

/* Exported types and constants */
/* ---------------------------- */

/* Types definition */
/* typedef */

/*==================================================*/
/* Declaration of exported constants                */
/*==================================================*/
/* BYTE constants */

/* WORD constants */

/* LONG and STRUCTURE constants */

/*======================================================*/
/* Definition of RAM variables                          */
/*======================================================*/
/* BYTES */

/* WORDS */

/* LONGS and STRUCTURES */

/*======================================================*/
/* close variable declaration sections                  */
/*======================================================*/

/* Exported functions prototypes and macros */
/* ---------------------------------------- */

/* Functions prototypes */

/*! Initialize the dc motor
*/
extern void vfnInit_DcMotor(void);

/*! Set the speed of the dc motor between the minVal and the maxVal
   \param uw_speed The value of the dc motor
   \param uw_minVal The min val of the dc motor
   \param uw_maxVal The max val of the dc motor
   \param uw_dcChannel Chosing the dc motor 
   \sa Version
  */
extern void vfnSet_DcMotor(T_UWORD uw_speed, T_UWORD uw_minVal, T_UWORD uw_maxVal, T_UWORD uw_dcChannel);

/* Functions macros */

/* Exported defines */

/*! \def Dc_Channel
Chanel of the Dc motor.
*/
#define Dc1_Channel			6
#define Dc2_Channel			7

/* \def Dc_Min_Us
Minimum value of the Dc motor in us
*/
#define Min_Us				4000

/* \def Dc_Max_us
Maximum value of the Dc motor in us
*/
#define Max_Us				18000

/* \def DC_StartS_Us
Starting speed of the Dc motor
*/
#define StartS_Us			(Min_Us + Max_Us) / 2

/* \def Dc_Pin
Pin connector of the Dc motor
*/
#define Dc1_Pin				PCR_EMIOS_0_6_1
#define Dc2_Pin				PCR_EMIOS_0_7_1

#endif
